home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 March / EnigmA AMIGA RUN 05 (1996)(G.R. Edizioni)(IT)[!][issue 1996-03][Skylink CD IV].iso / earcd / util2 / createdi.lha / CreateDI / cdata next >
Text File  |  1995-12-07  |  1KB  |  54 lines

  1. /*
  2.     $VER: CData V1.0 - Create Datafile for infofiles  (1995/12/07)
  3.  */
  4.  
  5.  
  6. Arg Dir Options
  7.     say
  8.     say 'CData V1.0 (Create Datafile for infofiles)'
  9.     say 'By christer.bjarnemo@mailbox.swipnet.se'
  10.     say ''
  11. If Dir = '?' | Dir = '/?' | Dir = '-?' | Dir = '' then signal Usage
  12.  
  13. if upper(Dir) = '-R' | upper(options) = '-R' then do
  14.     dir = ''
  15.     options = 'all'
  16. end
  17.  
  18. Address COMMAND 'list 'Dir' PAT #?.info FILES LFORMAT "%p%n" 'options' >t:CData.temp'
  19. Call Open(list,'t:CData.temp','R')
  20.  
  21. DO forever
  22.     Line = ReadLN(list)
  23.     File = line
  24.     if eof(list) then break
  25.     NewFile = Left(File,Length(file)-5)
  26.  
  27.     If ~EXISTS(newfile) then do
  28.         say 'Creating 'newfile
  29.         if ~open(1,newfile,'W') then do
  30.             say 'ERROR while creating 'newfile
  31.             exit
  32.         end
  33.         close(1)
  34.     end
  35.     else say '* Skipping 'newfile', file already exists...'
  36.  
  37. END
  38. Call Close(list)
  39.  
  40. Address COMMAND 'Delete >NIL: t:CData.temp'
  41.  
  42. say
  43. say 'Operation complete.'
  44. say
  45. EXIT
  46.  
  47. Usage:
  48. say 'Usage: CData <dir> [options]'
  49. say
  50. say 'Available options:'
  51. say '-r  Recursive'
  52. say
  53. EXIT
  54.